from code_analysis.analyzer import Analyzer
from code_processing.processor import CodeProcessor
import warnings
import os

from data_store.sqlite_api import SqliteApi
from file_processing.file_manager import FileManager

if __name__ == '__main__':
    warnings.filterwarnings("ignore")
    sqlite_api = SqliteApi()
    code_processor = CodeProcessor()
    if not os.path.exists('build/my-languages.so'):
        code_processor.build_library()

    file_manager = FileManager()

    files_list = file_manager.get_path_list()
    code_chunks = code_processor.process_list(files_list)
    # print(code_chunks)

    # files_tree = file_manager.get_path_tree()
    # code_chunks = code_processor.process_tree(files_tree)
    # print(code_chunks)
    sqlite_api.create_table('code_analysis_results')
    analyzer = Analyzer()
    analyzer.run(code_chunks)
